package com.tingyukeji.fastpay.my.fragment;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.tingyukeji.fastpay.R;
import com.tingyukeji.fastpay.base.BaseFragment;
import com.tingyukeji.fastpay.databinding.DebitBankCardFragmentBinding;
import com.tingyukeji.fastpay.my.adapter.BankListAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/5/31.
 */

public class DebitBankCardFragment extends BaseFragment {
    private DebitBankCardFragmentBinding binding;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (null == rootView) {
            binding = DataBindingUtil.inflate(inflater, R.layout.debit_bank_card_fragment, container, false);
            rootView = binding.getRoot();
            initView();
        } else {
            ViewGroup parent = (ViewGroup) rootView.getParent();
            if (parent != null) {
                parent.removeView(rootView);
            }
        }
        return rootView;
    }

    @Override
    protected void initView() {
        super.initView();
        initBankList();
    }

    private void initBankList() {
        List<Integer> commList = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            commList.add(i);
        }
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
        binding.debitBankListRecyclerview.setLayoutManager(linearLayoutManager); //给RecyClerView 添加设置好的布局样式
        BankListAdapter bankListAdapter = new BankListAdapter(commList,context,false); //初始化适配器
        binding.debitBankListRecyclerview.setAdapter(bankListAdapter); // 对 recyclerview 添加数据内容

    }

}
